package org.ovirt.microvirt.beans;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;

@Entity
@Table(name="hosts")
@Indexed
@XmlRootElement(name="host")
public class Host implements Serializable {
	private static final long serialVersionUID = -3216564187949784599L;
	@Id
	@Column(name="hostname")
	@Field
	String name;
	@Column(name="rootpass")
	String rootPassword;
	@Column(name="addr", nullable=false)
	@Field
	String addr;
	@OneToOne
	LomSettings lomSettings = null;
	@Column(name="dedicated")
	boolean dedicated = false;
	@XmlElement(name="name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@XmlElement(name="address")
	public String getAddr() {
		return addr;
	}
	public void setAddr(String addr) {
		this.addr = addr;
	}
	public LomSettings getLomSettings() {
		return lomSettings;
	}
	public void setLomSettings(LomSettings lomSettings) {
		this.lomSettings = lomSettings;
	}
	@XmlAttribute(name="dedicated")
	public boolean isDedicated() {
		return dedicated;
	}
	public void setDedicated(boolean dedicated) {
		this.dedicated = dedicated;
	}
	@XmlElement(name="rootPassword")
	public String getRootPassword() {
		return rootPassword;
	}
	public void setRootPassword(String rootPassword) {
		this.rootPassword = rootPassword;
	}
}
